#include<iostream>
using namespace std;
const int N = 1e4 + 10;
struct node
{
	int a, b;
}s[N];
int a, b, n;
int main()
{
	cin >> n;
	int ans1 = 0;
	bool flag = 0;
	for (int i = 0; i < n; i++) {
		cin >> a >> b;
		s[i] = { a,b };
		ans1 = max(ans1, a / b);
		if (a == b) flag = 1;
	}
	if (flag) {
		cout << 1 << " " << 1 << endl;
		return 0;
	}
	int mi = 1e9;
	int ma = 0;
	for (int i = 1; i <= ans1; i++) {
		bool flag1 = 0;
		for (int j = 0; j < n; j++) {
			int x = s[i].a;
			int y = s[i].b;
			int k = x / i;
			if (k != b) {
				flag1 = 1;
				break;
			}
		}
		if (!flag1) {
			mi = min(mi, i);
			ma = max(ma, i);
		}
	}
	cout << mi << " " << ma << endl;
	return 0;
}

nlogn
